<%--
 - Copyright (c) 2009-2011 ETCORE Labs. All rights reserved. 
 - 
 - This software is the confidential and proprietary information of ETCORE Labs. 
 - You shall not disclose such confidential information and shall use it only
 - in accordance with the terms of the license agreement you entered into
 - with ETCORE Labs.
 -
 - Support can be obtained from support forums at:
 - http://www.etcore.com/
 -
 - @author: ETCORE GroupTalk developers
 -
 --%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/taglibs/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><c:out value='${context.management}' />-<c:out
	value='${context.title}' /></title>
<link rel="stylesheet" href="/group/css/styles.css" type="text/css">
<link rel="stylesheet"
	href="/group/ui-component/chart/styles/flowchart.css" type="text/css">
<script>
var width=window.screen.width;
 
var n=5;
if(width>=1600){
n=8;
 
}
else if(width>1200)
n=7;	
else if(width<=800){
n=4;
 
}
</script>
<script>
function  showGroupButtonMenu(id){
	var buttonId="groupButtonMenu"+id;
	var groupButtonMenuFrame=document.getElementById(buttonId); 
 	groupButtonMenuFrame.style.display =  "block" ;  
	
}
function  hideGroupButtonMenu(id){
	var buttonId="groupButtonMenu"+id;
	var groupButtonMenuFrame=document.getElementById(buttonId); 
	groupButtonMenuFrame.style.display =  "none" ;  
	if(groupButtonMenuFrame.contains(event.toElement))groupButtonMenuFrame.style.display =  "block" ;  
	
}
function showEditDirectory(id){

	 
	var element=document.getElementById(id);
	

	var leftOffset=(document.body.clientWidth-350)/2;
	element.style.left=leftOffset; 
	var topOffset=(document.body.clientHeight-160)/2;
	element.style.top=topOffset+document.body.scrollTop; 
	element.style.display=""; 	
	var winback=document.getElementById("winback"); 
	winback.style.display =  "" ; 
	winback.style.height=document.body.scrollHeight;
 

}
function hideEditDirectory(id){
	var element=document.getElementById(id);
	element.style.display="none";
	var winback=document.getElementById("winback"); 
	winback.style.display =  "none" ; 

 
}

</script>
</head>
<body bottomMargin=0 leftMargin=10 topMargin=0 rightMargin=10
	marginheight="0">

<c:import url="/group/ui-component/divdialog/divdialog.html" />

<TABLE cellSpacing=0 cellPadding=0 width=100% border=0 align=center>
	<TBODY>
		<tr>
			<td><c:import url="/banner.jsp?currentPlatform=0" /></td>
		</tr>

		<TR>

			<TD valign=top width=100%>
			<table style="margin-top: 10px;">
				<tr>
					<c:if test="${isAdmin }">

						<td width=120 nowrap valign=top><c:import
							url="/group/adminMenu.jsp?currentPlatform=0" /></td>

					</c:if>

					<td valign=top><c:if test="${empty param.open }">
						<table>
							<tr>
								<td>
								<table cellspacing=4 cellpadding=4
									style="border: 1px solid #d2d4d2">
									<tr>
										<td colspan=3 align=center>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=1&nav=0';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td
													<c:if test="${!context.p1}">style="height: 50px; font-size: 17px; color:#808080;font-weight: bold" </c:if>
													<c:if test="${context.p1}">style="height: 50px; font-size: 17px;  font-weight: bold" </c:if>
													align=center><c:out value='${context.platform1}' /></td>


											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
									</tr>
									<tr>
										<td>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=3';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td
													<c:if test="${!context.p3}">style="height: 50px; font-size: 17px; color:#808080;font-weight: bold" </c:if>
													<c:if test="${context.p3}">style="height: 50px; font-size: 17px;  font-weight: bold" </c:if>
													align=center><c:out value='${context.platform3}' /></td>
											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
										<td>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/userShow<c:out value='${context.postfix}' />';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td style="height: 50px; font-size: 17px; font-weight: bold"
													align=center><c:out value='${context.user_management}' /></td>
											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
										<td>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=4';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td
													<c:if test="${!context.p4}">style="height: 50px; font-size: 17px; color:#808080;font-weight: bold" </c:if>
													<c:if test="${context.p4}">style="height: 50px; font-size: 17px;  font-weight: bold" </c:if>
													align=center><c:out value='${context.platform4}' /></td>
											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
									</tr>
									<tr>
										<td colspan=3 align=center>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=2&nav=0';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td
													<c:if test="${!context.p2}">style="height: 50px; font-size: 17px; color:#808080;font-weight: bold" </c:if>
													<c:if test="${context.p2}">style="height: 50px; font-size: 17px;  font-weight: bold" </c:if>
													align=center><c:out value='${context.platform2}' /></td>
											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
									</tr>
								</table>
								</td>
								<td>
								<table cellspacing=4 cellpadding=4
									style="border: 1px solid #d2d4d2">

									<tr>
										<td align=center>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=1&nav=1';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td style="height: 50px; font-size: 17px; font-weight: bold"
													align=center><c:out value='${context.nav1}' /></td>
											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
									</tr>
									<tr>
										<td align=center>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=0';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td style="height: 50px; font-size: 17px; font-weight: bold"
													align=center><c:out value='${context.platform0}' /></td>
											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
									</tr>
									<tr>
										<td align=center>
										<div style="width: 140px; cursor: pointer;"
											onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=2&nav=1';"><b
											class="rtop"><b class="r1"></b><b class="r2"></b><b
											class="r3"></b><b class="r4"></b></b>
										<table width=100% bgcolor="#B7A8E1">
											<tr>
												<td style="height: 50px; font-size: 17px; font-weight: bold"
													align=center><c:out value='${context.nav2}' /></td>
											</tr>


										</table>

										<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
											class="r2"></b><b class="r1"></b></b></div>
										</td>
									</tr>
								</table>



								</td>
							</tr>
						</table>

					</c:if> <c:if test="${not empty param.open }">
						<table>
							<tr>
								<td>

								<table>
									<tr>
										<td width=100 nowrap valign=top>
										<table>
											<tr>
												<td>

												<div style="width: 140px; cursor: pointer;"
													onclick="window.location.href='/group/groupadmin<c:out value='${context.postfix}' />?open=<c:out value='${param.open }'/>&nav=<c:out value='${param.nav }'/>';"><b
													class="rtop"><b class="r1"></b><b class="r2"></b><b
													class="r3"></b><b class="r4"></b></b>
												<table width=100% bgcolor="#B7A8E1">
													<tr>
														<td
															style="height: 50px; font-size: 17px; font-weight: bold"
															align=center><c:set var="platform"
															value="platform${param.open }" /> <c:if
															test="${not empty param.nav && param.nav==1&&param.open==1}">
															<c:set var="platform" value="nav1" />
														</c:if> <c:if
															test="${not empty param.nav && param.nav==1&&param.open==2}">
															<c:set var="platform" value="nav2" />
														</c:if> <c:out value='${context[platform]}' /></td>
													</tr>


												</table>

												<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
													class="r2"></b><b class="r1"></b></b></div>
												</td>
											</tr>

										</table>



										</td>
										<td width=100%>

										<fieldset style="border: 1px solid #d2d4d2; width: 100%">
										<legend
											style="font-size: 16px; font-weight: bold; background: #E3EEFB; width: 150px; text-align: center;"><c:out
											value="${context.default_pool }" /></legend>
										<table>

											<c:set var="count" value="-1" />
											<c:forEach var="group" items="${rootGroups }">
												<c:if test="${!(group.open==0&&group.name eq 'roots')}">
													<c:set var="count" value="${count+1 }" />
													<script>
					if(<c:out value='${count}'/>%n==0)
						document.write("<tr>");
					</script>

													<td align=center nowrap width=110>
													<div
														onmouseover="showGroupButtonMenu(<c:out value='${group.id }'/>)"
														onmouseout="hideGroupButtonMenu(<c:out value='${group.id }'/>)">
													<table>
														<tr>
															<td align=center nowrap><c:set var="viewer" value="" />
															<c:if test='${group.open!=3}'>
																<c:set var="viewer" value="groupdetail" />
															</c:if> <c:if test='${group.open==3 }'>
																<c:set var="viewer" value="bookmarksadmin" />
															</c:if> <a
																href="/group/<c:out value='${viewer}' /><c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />">
															<c:if
																test="${not empty group.pic &&fn:indexOf(group.pic,'upload')!=-1 }">
																<img border=0 src="/<c:out value='${group.pic}' />"
																	width=48 height=48>
															</c:if> <c:if
																test="${empty group.pic ||fn:indexOf(group.pic,'upload')==-1 }">
																<img border=0 src="/group/images/root.gif" width=48
																	height=48>
															</c:if><br />
															<b><c:out value='${group.name}' /></b> </a></td>
															<td>

															<div id="groupButtonMenu<c:out value='${group.id }'/>"
																style="display: none; position: absolute; padding: 0px; border: 1px solid #b4d2d4; background-color: white; overflow: auto;">

															<table cellspacing=10>

																<tr>
																	<td nowrap valign=bottom><font color=#999999><c:out
																		value='${context.text_all}' /></font>: <a
																		href="/group/<c:out value='${viewer}' /><c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />">
																	<c:set var="groupMsgCount"
																		value="${group.id}groupMsgCount" /> <font
																		color=#999999><c:out
																		value='${requestScope[groupMsgCount]}' /></font> </a> <font
																		color=#999999><c:out
																		value='${context.text_today}' /></font>: <a
																		href="/group/<c:out value='${viewer}' /><c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />">
																	<c:set var="todayGroupMsgCount"
																		value="${group.id}todayGroupMsgCount" /> <font
																		color=#999999><c:out
																		value='${requestScope[todayGroupMsgCount]}' /></font> </a><br />
																	<a
																		href="/group/editGroup<c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />"><c:out
																		value='${context.edit_group}' /></a><font color=#999999>|</font><a
																		href="/group/manageTopic<c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />"><c:out
																		value='${context.manage_topic}' /></a>&nbsp;

																	<form method=post
																		action="/group/groupadmin<c:out value='${context.postfix}' />">
																	<input type=hidden name=cmd value="processBlock">
																	<input type=hidden name=nav
																		value="<c:out value='${param.nav }'/>"> <input
																		type=hidden name=open
																		value="<c:out value='${param.open }'/>"> <input
																		type=hidden name=gid
																		value="<c:out value='${group.id}'/>"><c:out
																		value="${context.block }" />:<select
																		onchange="this.form.submit()" name=did size=1>
																		<option value="0"><c:out
																			value="${context.default_pool }" /></option>
																		<c:forEach var="internalDirectory"
																			items="${directories }">
																			<option value="${internalDirectory.id }">${internalDirectory.name
																			}</option>
																		</c:forEach>
																	</select></form>

																	</td>



																</tr>

															</table>

															</div>
															</td>

														</tr>
													</table>
													</div>
													</td>

													<script>
					if(<c:out value='${count}'/>%n==n-1)
						document.write("</tr>");
					</script>
												</c:if>
											</c:forEach>
										</table>
										</fieldset>
										<c:forEach var="directory" items="${directories }">
											<br />

											<fieldset style="border: 1px solid #d2d4d2; width: 100%;">
											<legend
												style="font-size: 16px; font-weight: bold; background: #C8C8C8; width: 150px; white-space: nowrap; text-align: center;"><c:out
												value="${directory.name }" /></legend> <c:set var="directoryGroups"
												value="${directory.id }groups" />
											<table width=100%>
												<tr>
													<td valign=top align=right width=100%><a href="#"
														onclick="showEditDirectory('editDirectory<c:out value='${directory.id }' />')"><img
														src="/group/images/edit.jpg" border=0 /></a>&nbsp;<a
														href="/group/groupadmin<c:out value='${context.postfix }' />?cmd=delDirectory&did=<c:out value='${directory.id}' />&open=<c:out value='${param.open}' />&nav=<c:out value='${param.nav}' />"
														onclick='if(window.confirm("<c:out value='${context.msg_del_now }'/>")){return true;}else{return false;}'><img
														src="/group/images/button_delete.gif" border=0 /></a>

													<div id="editDirectory<c:out value='${directory.id }' />"
														style="display: none; valign: center; position: absolute; top: 15%; left: 20%; width: 350px; padding: 0px; border: 1px solid orange; background-color: white; z-index: 1002; overflow: hidden;">

													<FORM id="directoryForm<c:out value='${directory.id }' />"
														onSubmit="return checkForm('directoryForm<c:out value='${directory.id }' />');"
														method=post
														action="/group/groupadmin<c:out value='${context.postfix }' />">
													<input type=hidden name=cmd value="editDirectory">
													<input type=hidden name=did
														value="<c:out value='${directory.id }' />"> <input
														type=hidden name=open
														value="<c:out value='${param.open }' />"> <input
														type=hidden name=nav
														value="<c:out value='${param.nav }' />">
													<table align=center bgcolor="#B7B7B7" cellpadding="0"
														cellspacing="0" border="0" width=100%>
														<tr bgcolor="orange">
															<td nowrap><img src="/group/images/winlogo.gif"
																border=0>&nbsp;<b><c:out
																value='${context.edit_directory }' /></b></td>
															<td align=right><img src="/group/images/close.gif"
																class=close
																onClick="hideEditDirectory('editDirectory<c:out value='${directory.id }' />')"
																border=0 /></td>
														</tr>
														<tr>
															<td colspan=2>
															<table bgcolor="#B7B7B7" cellpadding=3 cellspacing=1
																border=0 width=100% align=center>
																<tr bgcolor=#F3F3F3>
																	<td colspan=2 align="center" nowrap><font size="2"
																		face="verdana"><b><c:out
																		value='${context.edit_directory }' /></b></font></td>
																</tr>
																<tr bgcolor="#ffffff">
																	<td align="right" width="100" nowrap><c:out
																		value='${context.text_name}' />&nbsp;&nbsp;</TD>
																	<TD align=left><input type=text name="name"
																		size=25 value="<c:out value='${directory.name }' />"
																		maxlength=120></TD>
																</TR>
																<tr bgcolor="#ffffff">
																	<td align="right"><c:out
																		value='${context.text_rank}' />&nbsp;&nbsp;</TD>
																	<TD align=left><select name=up>
																		<option value="${directoriesCount }">NO</option>
																		<c:set var="up" value="0" />
																		<c:forEach begin="1" end="${directoriesCount }"
																			step="1">
																			<c:set var="up" value="${up+1 }" />
																			<option value="<c:out value='${up }' />"
																				<c:if test="${up==directory.up}" >selected</c:if>><c:out
																				value='${up }' /></option>
																		</c:forEach>

																	</select></TD>
																</TR>
																<tr bgcolor="#ffffff">
																	<td align="right"><c:out value='${context.en}' />&nbsp;&nbsp;</TD>
																	<TD align=left>Yes<input type=radio name="en"
																		value=1
																		<c:if test="${directory.en==1 }" > checked</c:if>>
																	&nbsp; No<input type=radio name="en" value=0
																		<c:if test="${directory.en==0 }" > checked</c:if>></TD>
																</tr>

																<tr bgcolor="#ffffff">
																	<td align="right"><c:out value='${context.local}' />&nbsp;&nbsp;</TD>
																	<TD align=left>Yes<input type=radio name="local"
																		value=1
																		<c:if test="${directory.local==1 }" > checked</c:if>>
																	&nbsp; No<input type=radio name="local" value=0
																		<c:if test="${directory.local==0 }" > checked</c:if>></TD>
																</TR>
																<tr bgcolor=#F3F3F3>
																	<td align="center" colspan=2><input type=submit
																		value="<c:out value='${context.button_ok}' />">&nbsp;&nbsp;<input
																		type=button
																		onclick="hideEditDirectory('editDirectory<c:out value='${directory.id }' />')"
																		value="<c:out value='${context.button_cancel}' />"></td>
																</tr>
															</table>
															</td>
														</tr>
													</table>

													</FORM>

													</div>

													</td>
												</tr>
												<tr>
													<td width=100%>
													<table>
														<c:set var="count" value="-1" />
														<c:forEach var="group"
															items="${requestScope[directoryGroups] }">
															<c:if test="${!(group.open==0&&group.name eq 'roots')}">
																<c:set var="count" value="${count+1 }" />
																<script>
					if(<c:out value='${count}'/>%n==0)
						document.write("<tr>");
					</script>

																<td nowrap width=110 align=left>
																<div
																	onmouseover="showGroupButtonMenu(<c:out value='${group.id }'/>)"
																	onmouseout="hideGroupButtonMenu(<c:out value='${group.id }'/>)">
																<table width=110>
																	<tr>
																		<td align=center nowrap><c:set var="viewer"
																			value="" /> <c:if test='${group.open!=3}'>
																			<c:set var="viewer" value="groupdetail" />
																		</c:if> <c:if test='${group.open==3 }'>
																			<c:set var="viewer" value="bookmarksadmin" />
																		</c:if> <a
																			href="/group/<c:out value='${viewer}' /><c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />">
																		<c:if
																			test="${not empty group.pic &&fn:indexOf(group.pic,'upload')!=-1 }">
																			<img border=0 src="/<c:out value='${group.pic}' />"
																				width=48 height=48>
																		</c:if> <c:if
																			test="${empty group.pic ||fn:indexOf(group.pic,'upload')==-1 }">
																			<img border=0 src="/group/images/root.gif" width=48
																				height=48>
																		</c:if><br />
																		<b><c:out value='${group.name}' /></b> </a></td>
																		<td>

																		<div id="groupButtonMenu<c:out value='${group.id }'/>"
																			style="display: none; position: absolute; padding: 0px; border: 1px solid #b4d2d4; background-color: white; overflow: auto;">

																		<table cellspacing=10>
																			<tr>
																				<td align=left nowrap><font color=#999999><c:out
																					value='${context.text_all}' /></font>: <a
																					href="/group/<c:out value='${viewer}' /><c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />">
																				<c:set var="groupMsgCount"
																					value="${group.id}groupMsgCount" /> <font
																					color=#999999><c:out
																					value='${requestScope[groupMsgCount]}' /></font> </a> <font
																					color=#999999><c:out
																					value='${context.text_today}' /></font>: <a
																					href="/group/<c:out value='${viewer}' /><c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />">
																				<c:set var="todayGroupMsgCount"
																					value="${group.id}todayGroupMsgCount" /><font
																					color=#999999><c:out
																					value='${requestScope[todayGroupMsgCount]}' /></font> </a><br />
																				<a
																					href="/group/editGroup<c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />"><c:out
																					value='${context.edit_group}' /></a><font
																					color=#999999>|</font><a
																					href="/group/manageTopic<c:out value='${context.postfix}' />?id=<c:out value='${group.id}' />"><c:out
																					value='${context.manage_topic}' /></a>&nbsp;
																				<form method=post
																					action="/group/groupadmin<c:out value='${context.postfix}' />">
																				<input type=hidden name=cmd value="processBlock">
																				<input type=hidden name=nav
																					value="<c:out value='${param.nav }'/>"> <input
																					type=hidden name=open
																					value="<c:out value='${param.open }'/>"> <input
																					type=hidden name=gid
																					value="<c:out value='${group.id}'/>"><c:out
																					value="${context.block }" />: <select
																					onchange="this.form.submit()" name=did size=1>
																					<option value="0"><c:out
																						value="${context.default_pool }" /></option>
																					<c:forEach var="internalDirectory"
																						items="${directories }">
																						<option value="${internalDirectory.id }"
																							<c:if test="${internalDirectory.id==directory.id }">selected</c:if>>${internalDirectory.name
																						}</option>
																					</c:forEach>
																				</select></form>
																				&nbsp;</td>
																			</tr>



																		</table>

																		</div>
																		</td>

																	</tr>
																</table>
																</div>
																</td>

																<script>
					if(<c:out value='${count}'/>%n==n-1)
						document.write("</tr>");
					</script>
															</c:if>
														</c:forEach>
													</table>
													</td>
												</tr>
											</table>
											</fieldset>
										</c:forEach></td>
									</tr>
								</table>
								</td>
							</tr>
						</table>
					</c:if></td>
				</tr>
			</table>
			</TD>
		</TR>

		<tr>
			<td><BR>
			<BR>
			<BR>
			<BR>
			<c:import url="/footer.jsp" /></td>
		</tr>
</table>
</body>
</html>

